<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>广告</title>
    <style>
        #ad{
            width: 150px;
            height: 150px;
            background-color: yellow;
            position: fixed;
            right:0;
            bottom:-150px;
        }
        #ad>a{
            position: absolute;
            right:0;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div id="ad">
        <a href="#" >X</a>
        <p>广告内容</p>
    </div>
    <script>
        let ad = document.getElementById("ad");
        let intervalId = setInterval(() => {
            if(parseInt(ad.style.bottom || -150) < 0){
                ad.style.bottom = parseInt(ad.style.bottom || -150) + 10 + "px";
            }else{
                clearInterval(intervalId);
            }
        },100);
        let closeBtn = document.querySelector("#ad>a");
        closeBtn.onclick = function(){
            ad.style.display = "none";
        }
    </script>
</body>
</html>